home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / cc-mode / cc-langs.el.z / cc-langs.el
Encoding:
Text File  |  1998-05-21  |  20.3 KB  |  566 lines

  1. ;;; cc-langs.el --- specific language support for CC Mode
  2.  
  3. ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
  4.  
  5. ;; Authors:    1992-1997 Barry A. Warsaw
  6. ;;             1987 Dave Detlefs and Stewart Clamen
  7. ;;             1985 Richard M. Stallman
  8. ;; Maintainer: cc-mode-help@python.org
  9. ;; Created:    22-Apr-1997 (split from cc-mode.el)
  10. ;; Version:    See cc-mode.el
  11. ;; Keywords:   c languages oop
  12.  
  13. ;; This file is part of GNU Emacs.
  14.  
  15. ;; GNU Emacs is free software; you can redistribute it and/or modify
  16. ;; it under the terms of the GNU General Public License as published by
  17. ;; the Free Software Foundation; either version 2, or (at your option)
  18. ;; any later version.
  19.  
  20. ;; GNU Emacs is distributed in the hope that it will be useful,
  21. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  22. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  23. ;; GNU General Public License for more details.
  24.  
  25. ;; You should have received a copy of the GNU General Public License
  26. ;; along with GNU Emacs; see the file COPYING.  If not, write to the
  27. ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  28. ;; Boston, MA 02111-1307, USA.
  29.  
  30. (require 'cc-defs)
  31.  
  32.  
  33. ;; Regular expressions and other values which must be parameterized on
  34. ;; a per-language basis.
  35.  
  36. ;; Keywords defining protection levels
  37. (defconst c-protection-key "\\<\\(public\\|protected\\|private\\)\\>")
  38.  
  39. ;; Regex describing a `symbol' in all languages.  We cannot use just
  40. ;; `word' syntax class since `_' cannot be in word class.  Putting
  41. ;; underscore in word class breaks forward word movement behavior that
  42. ;; users are familiar with.  Besides, this runs counter to Emacs
  43. ;; convention.
  44. ;;
  45. ;; I suspect this definition isn't correct in light of Java's
  46. ;; definition of a symbol as being Unicode.  I know so little about
  47. ;; I18N (except how to sound cool and say I18N :-) that I'm willing to
  48. ;; punt on this for now.
  49.  
  50. (defconst c-symbol-key "[_a-zA-Z]\\(\\w\\|\\s_\\)*")
  51.  
  52.  
  53. ;; keywords introducing class definitions.  language specific
  54. (defconst c-C-class-key "\\(struct\\|union\\)")
  55. (defconst c-C++-class-key "\\(class\\|struct\\|union\\)")
  56. (defconst c-C-extra-toplevel-key "\\(extern\\)[^_]")
  57. (defconst c-C++-extra-toplevel-key "\\(extern\\|namespace\\)[^_]")
  58.  
  59. (defconst c-ObjC-class-key
  60.   (concat
  61.    "@\\(interface\\|implementation\\)\\s +"
  62.    c-symbol-key                ;name of the class
  63.    "\\(\\s *:\\s *" c-symbol-key "\\)?"    ;maybe followed by the superclass
  64.    "\\(\\s *<[^>]+>\\)?"        ;and maybe the adopted protocols list
  65.    ))
  66.  
  67. (defconst c-Java-class-key
  68.   (concat
  69.    "\\(" c-protection-key "\\s +\\)?"
  70.    "\\(interface\\|class\\)\\s +"
  71.    c-symbol-key                      ;name of the class
  72.    "\\(\\s *extends\\s *" c-symbol-key "\\)?" ;maybe followed by superclass 
  73.    ;;"\\(\\s *implements *[^{]+{\\)?"          ;maybe the adopted protocols list
  74.    ))
  75.  
  76. (defvar c-class-key c-C-class-key)
  77. (make-variable-buffer-local 'c-class-key)
  78.  
  79. (defvar c-extra-toplevel-key c-C-extra-toplevel-key)
  80. (make-variable-buffer-local 'c-extra-toplevel-key)
  81.  
  82.  
  83. ;; regexp describing access protection clauses.  language specific
  84. (defvar c-access-key nil)
  85. (make-variable-buffer-local 'c-access-key)
  86. (defconst c-C++-access-key (concat c-protection-key "[ \t]*:"))
  87. (defconst c-ObjC-access-key (concat "@" c-protection-key))
  88. (defconst c-Java-access-key nil)
  89.  
  90.  
  91. ;; keywords introducing conditional blocks
  92. (defconst c-C-conditional-key nil)
  93. (defconst c-C++-conditional-key nil)
  94. (defconst c-Java-conditional-key nil)
  95.  
  96. (let ((all-kws "for\\|if\\|do\\|else\\|while\\|switch")
  97.       (exc-kws "\\|try\\|catch")
  98.       (thr-kws "\\|finally\\|synchronized")
  99.       (front   "\\b\\(")
  100.       (back    "\\)\\b[^_]"))
  101.   (setq c-C-conditional-key (concat front all-kws back)
  102.     c-C++-conditional-key (concat front all-kws exc-kws back)
  103.     c-Java-conditional-key (concat front all-kws exc-kws thr-kws back)))
  104.  
  105. (defvar c-conditional-key c-C-conditional-key)
  106. (make-variable-buffer-local 'c-conditional-key)
  107.  
  108.  
  109. ;; keywords describing method definition introductions
  110. (defvar c-method-key nil)
  111. (make-variable-buffer-local 'c-method-key)
  112.  
  113. (defconst c-ObjC-method-key
  114.   (concat
  115.    "^\\s *[+-]\\s *"
  116.    "\\(([^)]*)\\)?"            ; return type
  117.    ;; \\s- in objc syntax table does not include \n
  118.    ;; since it is considered the end of //-comments.
  119.    "[ \t\n]*" c-symbol-key))
  120.  
  121.  
  122.  
  123. ;; comment starter definitions for various languages.  language specific
  124. (defconst c-C++-comment-start-regexp "/[/*]")
  125. ;; We need to match all 3 Java style comments
  126. ;; 1) Traditional C block; 2) javadoc /** ...; 3) C++ style
  127. (defconst c-Java-comment-start-regexp "/\\(/\\|[*][*]?\\)")
  128. (defvar c-comment-start-regexp c-C++-comment-start-regexp)
  129. (make-variable-buffer-local 'c-comment-start-regexp)
  130.  
  131.  
  132.  
  133. ;; Regexp describing a switch's case or default label for all languages
  134. (defconst c-switch-label-key "\\(\\(case[( \t]+\\S .*\\)\\|default[ \t]*\\):")
  135. ;; Regexp describing any label.
  136. (defconst c-label-key (concat c-symbol-key ":\\([^:]\\|$\\)"))
  137.  
  138. ;; Regexp describing class inheritance declarations.  TBD: this should
  139. ;; be language specific, and only makes sense for C++
  140. (defconst c-inher-key
  141.   (concat "\\(\\<static\\>\\s +\\)?"
  142.       c-C++-class-key "[ \t]+" c-symbol-key
  143.       "\\([ \t]*:[ \t]*\\)\\s *[^;]"))
  144.  
  145. ;; Regexp describing C++ base classes in a derived class definition.
  146. ;; TBD: this should be language specific, and only makes sense for C++
  147. (defvar c-baseclass-key
  148.   (concat
  149.    ":?[ \t]*\\(virtual[ \t]+\\)?\\("
  150.    c-protection-key "[ \t]+\\)" c-symbol-key))
  151. (make-variable-buffer-local 'c-baseclass-key)
  152.  
  153. ;; Regexp describing friend declarations in C++ classes.
  154. (defconst c-C++-friend-key
  155.   "friend[ \t]+\\|template[ \t]*<.+>[ \t]*friend[ \t]+")
  156.  
  157. ;; Regexp describing Java inheritance and throws clauses.
  158. (defconst c-Java-special-key "\\(implements\\|extends\\|throws\\)[^_]")
  159.  
  160. ;; Regexp describing the beginning of a Java top-level definition.
  161. (defconst c-Java-defun-prompt-regexp
  162.   "^[ \t]*\\(\\(\\(public\\|protected\\|private\\|const\\|abstract\\|synchronized\\|final\\|static\\|threadsafe\\|transient\\|native\\|volatile\\)\\s-+\\)*\\(\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*[][_$.a-zA-Z0-9]+\\|[[a-zA-Z]\\)\\s-*\\)\\s-+\\)\\)?\\(\\([[a-zA-Z][][_$.a-zA-Z0-9]*\\s-+\\)\\s-*\\)?\\([_a-zA-Z][^][ \t:;.,{}()=]*\\|\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)\\)\\s-*\\(([^);{}]*)\\)?\\([] \t]*\\)\\(\\s-*\\<throws\\>\\s-*\\(\\([_$a-zA-Z][_$.a-zA-Z0-9]*\\)[, \t\n\r\f]*\\)+\\)?\\s-*")
  163.  
  164.  
  165.  
  166. ;; internal state variables
  167.  
  168. ;; Internal state of hungry delete key feature
  169. (defvar c-hungry-delete-key nil)
  170. (make-variable-buffer-local 'c-hungry-delete-key)
  171.  
  172. ;; Internal state of auto newline feature.
  173. (defvar c-auto-newline nil)
  174. (make-variable-buffer-local 'c-auto-newline)
  175.  
  176. ;; Internal auto-newline/hungry-delete designation string for mode line.
  177. (defvar c-auto-hungry-string nil)
  178. (make-variable-buffer-local 'c-auto-hungry-string)
  179.  
  180. ;; Non-nil means K&R style argument declarations are valid.
  181. (defvar c-recognize-knr-p t)
  182. (make-variable-buffer-local 'c-recognize-knr-p)
  183.  
  184.  
  185.  
  186. (defun c-use-java-style ()
  187.   "Institutes `java' indentation style.
  188. For use with the variable `java-mode-hook'."
  189.   (c-set-style "java"))
  190.  
  191. (defun c-common-init ()
  192.   ;; Common initializations for all modes.
  193.   ;; these variables should always be buffer local; they do not affect
  194.   ;; indentation style.
  195.   (make-local-variable 'paragraph-start)
  196.   (make-local-variable 'paragraph-separate)
  197.   (make-local-variable 'paragraph-ignore-fill-prefix)
  198.   (make-local-variable 'require-final-newline)
  199.   (make-local-variable 'parse-sexp-ignore-comments)
  200.   (make-local-variable 'indent-line-function)
  201.   (make-local-variable 'indent-region-function)
  202.   (make-local-variable 'comment-start)
  203.   (make-local-variable 'comment-end)
  204.   (make-local-variable 'comment-column)
  205.   (make-local-variable 'comment-start-skip)
  206.   (make-local-variable 'comment-multi-line)
  207.   (make-local-variable 'outline-regexp)
  208.   (make-local-variable 'outline-level)
  209.   (make-local-variable 'adaptive-fill-regexp)
  210.   (make-local-variable 'imenu-generic-expression) ;set in the mode functions
  211.   ;; X/Emacs 20 only
  212.   (and (boundp 'comment-line-break-function)
  213.        (make-local-variable 'comment-line-break-function))
  214.   ;; Emacs 19.30 and beyond only, AFAIK
  215.   (if (boundp 'fill-paragraph-function)
  216.       (progn
  217.     (make-local-variable 'fill-paragraph-function)
  218.     (setq fill-paragraph-function 'c-fill-paragraph)))
  219.   ;; now set their values
  220.   (setq paragraph-start (concat page-delimiter "\\|$")
  221.     paragraph-separate paragraph-start
  222.     paragraph-ignore-fill-prefix t
  223.     require-final-newline t
  224.     parse-sexp-ignore-comments t
  225.     indent-line-function 'c-indent-line
  226.     indent-region-function 'c-indent-region
  227.     outline-regexp "[^#\n\^M]"
  228.     outline-level 'c-outline-level
  229.     comment-column 32
  230.     comment-start-skip "/\\*+ *\\|// *"
  231.     comment-multi-line nil
  232.     comment-line-break-function 'c-comment-line-break-function
  233.     adaptive-fill-regexp nil)
  234.   ;; we have to do something special for c-offsets-alist so that the
  235.   ;; buffer local value has its own alist structure.
  236.   (setq c-offsets-alist (copy-alist c-offsets-alist))
  237.   ;; setup the comment indent variable in a Emacs version portable way
  238.   ;; ignore any byte compiler warnings you might get here
  239.   (make-local-variable 'comment-indent-function)
  240.   (setq comment-indent-function 'c-comment-indent)
  241.   ;; add menus to menubar
  242.   (easy-menu-add (c-mode-menu mode-name))
  243.   ;; put auto-hungry designators onto minor-mode-alist, but only once
  244.   (or (assq 'c-auto-hungry-string minor-mode-alist)
  245.       (setq minor-mode-alist
  246.         (cons '(c-auto-hungry-string c-auto-hungry-string)
  247.           minor-mode-alist))))
  248.  
  249. (defun c-postprocess-file-styles ()
  250.   "Function that post processes relevant file local variables.
  251. Currently, this function simply applies any style and offset settings
  252. found in the file's Local Variable list.  It first applies any style
  253. setting found in `c-file-style', then it applies any offset settings
  254. it finds in `c-file-offsets'.
  255.  
  256. Note that the style variables are always made local to the buffer."
  257.   ;; apply file styles and offsets
  258.   (if (or c-file-style c-file-offsets)
  259.       (c-make-styles-buffer-local t))
  260.   (and c-file-style
  261.        (c-set-style c-file-style))
  262.   (and c-file-offsets
  263.        (mapcar
  264.     (function
  265.      (lambda (langentry)
  266.        (let ((langelem (car langentry))
  267.          (offset (cdr langentry)))
  268.          (c-set-offset langelem offset)
  269.          )))
  270.     c-file-offsets)))
  271.  
  272. (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles)
  273.  
  274.  
  275. ;; Common routines
  276. (defun c-make-inherited-keymap ()
  277.   (let ((map (make-sparse-keymap)))
  278.     (cond
  279.      ;; XEmacs 19 & 20
  280.      ((fboundp 'set-keymap-parents)
  281.       (set-keymap-parents map c-mode-base-map))
  282.      ;; Emacs 19
  283.      ((fboundp 'set-keymap-parent)
  284.       (set-keymap-parent map c-mode-base-map))
  285.      ;; incompatible
  286.      (t (error "CC Mode is incompatible with this version of Emacs")))
  287.     map))
  288.  
  289. (defun c-populate-syntax-table (table)
  290.   ;; Populate the syntax TABLE
  291.   ;; DO NOT TRY TO SET _ (UNDERSCORE) TO WORD CLASS!
  292.   (modify-syntax-entry ?_  "_"     table)
  293.   (modify-syntax-entry ?\\ "\\"    table)
  294.   (modify-syntax-entry ?+  "."     table)
  295.   (modify-syntax-entry ?-  "."     table)
  296.   (modify-syntax-entry ?=  "."     table)
  297.   (modify-syntax-entry ?%  "."     table)
  298.   (modify-syntax-entry ?<  "."     table)
  299.   (modify-syntax-entry ?>  "."     table)
  300.   (modify-syntax-entry ?&  "."     table)
  301.   (modify-syntax-entry ?|  "."     table)
  302.   (modify-syntax-entry ?\' "\""    table)
  303.   ;; Set up block and line oriented comments.  The new C standard
  304.   ;; mandates both comment styles even in C, so since all languages
  305.   ;; now require dual comments, we make this the default.
  306.   (cond
  307.    ;; XEmacs 19 & 20
  308.    ((memq '8-bit c-emacs-features)
  309.     (modify-syntax-entry ?/  ". 1456" table)
  310.     (modify-syntax-entry ?*  ". 23"   table))
  311.    ;; Emacs 19 & 20
  312.    ((memq '1-bit c-emacs-features)
  313.     (modify-syntax-entry ?/  ". 124b" table)
  314.     (modify-syntax-entry ?*  ". 23"   table))
  315.    ;; incompatible
  316.    (t (error "CC Mode is incompatible with this version of Emacs"))
  317.    )
  318.   (modify-syntax-entry ?\n "> b"  table)
  319.   ;; Give CR the same syntax as newline, for selective-display
  320.   (modify-syntax-entry ?\^m "> b" table))
  321.  
  322.  
  323. (defvar c-mode-base-map ()
  324.   "Keymap shared by all CC Mode related modes.")
  325.  
  326. (if c-mode-base-map
  327.     nil
  328.   ;; TBD: should we even worry about naming this keymap. My vote: no,
  329.   ;; because Emacs and XEmacs do it differently.
  330.   (setq c-mode-base-map (make-sparse-keymap))
  331.   ;; put standard keybindings into MAP
  332.   ;; the following mappings correspond more or less directly to BOCM
  333.   (define-key c-mode-base-map "{"         'c-electric-brace)
  334.   (define-key c-mode-base-map "}"         'c-electric-brace)
  335.   (define-key c-mode-base-map ";"         'c-electric-semi&comma)
  336.   (define-key c-mode-base-map "#"         'c-electric-pound)
  337.   (define-key c-mode-base-map ":"         'c-electric-colon)
  338.   ;; Separate M-BS from C-M-h.  The former should remain
  339.   ;; backward-kill-word.
  340.   (define-key c-mode-base-map [(control meta h)] 'c-mark-function)
  341.   (define-key c-mode-base-map "\e\C-q"    'c-indent-exp)
  342.   (define-key c-mode-base-map "\ea"       'c-beginning-of-statement)
  343.   (define-key c-mode-base-map "\ee"       'c-end-of-statement)
  344.   ;; RMS says don't make these the default.
  345. ;;  (define-key c-mode-base-map "\e\C-a"    'c-beginning-of-defun)
  346. ;;  (define-key c-mode-base-map "\e\C-e"    'c-end-of-defun)
  347.   (define-key c-mode-base-map "\C-c\C-n"  'c-forward-conditional)
  348.   (define-key c-mode-base-map "\C-c\C-p"  'c-backward-conditional)
  349.   (define-key c-mode-base-map "\C-c\C-u"  'c-up-conditional)
  350.   (define-key c-mode-base-map "\t"        'c-indent-command)
  351.   ;; Caution!  Enter here at your own risk.  We are trying to support
  352.   ;; several behaviors and it gets disgusting. :-(
  353.   ;;
  354.   ;; In XEmacs 19, Emacs 19, and Emacs 20, we use this to bind
  355.   ;; backwards deletion behavior to DEL, which both Delete and
  356.   ;; Backspace get translated to.  There's no way to separate this
  357.   ;; behavior in a clean way, so deal with it!  Besides, it's been
  358.   ;; this way since the dawn of BOCM.
  359.   (if (not (boundp 'delete-key-deletes-forward))
  360.       (define-key c-mode-base-map "\177" 'c-electric-backspace)
  361.     ;; However, XEmacs 20 actually achieved enlightenment.  It is
  362.     ;; possible to sanely define both backward and forward deletion
  363.     ;; behavior under X separately (TTYs are forever beyond hope, but
  364.     ;; who cares?  XEmacs 20 does the right thing with these too).
  365.     (define-key c-mode-base-map [delete]    'c-electric-delete)
  366.     (define-key c-mode-base-map [backspace] 'c-electric-backspace))
  367.   ;; these are new keybindings, with no counterpart to BOCM
  368.   (define-key c-mode-base-map ","         'c-electric-semi&comma)
  369.   (define-key c-mode-base-map "*"         'c-electric-star)
  370.   (define-key c-mode-base-map "/"         'c-electric-slash)
  371.   (define-key c-mode-base-map "\C-c\C-q"  'c-indent-defun)
  372.   (define-key c-mode-base-map "\C-c\C-\\" 'c-backslash-region)
  373.   ;; TBD: where if anywhere, to put c-backward|forward-into-nomenclature
  374.   (define-key c-mode-base-map "\C-c\C-a"  'c-toggle-auto-state)
  375.   (define-key c-mode-base-map "\C-c\C-b"  'c-submit-bug-report)
  376.   (define-key c-mode-base-map "\C-c\C-c"  'comment-region)
  377.   (define-key c-mode-base-map "\C-c\C-d"  'c-toggle-hungry-state)
  378.   (define-key c-mode-base-map "\C-c\C-o"  'c-set-offset)
  379.   (define-key c-mode-base-map "\C-c\C-s"  'c-show-syntactic-information)
  380.   (define-key c-mode-base-map "\C-c\C-t"  'c-toggle-auto-hungry-state)
  381.   (define-key c-mode-base-map "\C-c."     'c-set-style)
  382.   ;; conflicts with OOBR
  383.   ;;(define-key c-mode-base-map "\C-c\C-v"  'c-version)
  384.   )
  385.  
  386. ;; menu support for both XEmacs and Emacs.  If you don't have easymenu
  387. ;; with your version of Emacs, you are incompatible!
  388. (require 'easymenu)
  389.  
  390. (defvar c-c-menu nil)
  391. (defvar c-c++-menu nil)
  392. (defvar c-objc-menu nil)
  393. (defvar c-java-menu nil)
  394.  
  395. (defun c-mode-menu (modestr)
  396.   (let ((m
  397.      '(["Comment Out Region"     comment-region (mark)]
  398.        ["Uncomment Region"
  399.         (comment-region (region-beginning) (region-end) '(4))
  400.         (mark)]
  401.        ["Fill Comment Paragraph" c-fill-paragraph t]
  402.        "---"
  403.        ["Indent Expression"      c-indent-exp
  404.         (memq (char-after) '(?\( ?\[ ?\{))]
  405.        ["Indent Line"            c-indent-command t]
  406.        ["Up Conditional"         c-up-conditional t]
  407.        ["Backward Conditional"   c-backward-conditional t]
  408.        ["Forward Conditional"    c-forward-conditional t]
  409.        ["Backward Statement"     c-beginning-of-statement t]
  410.        ["Forward Statement"      c-end-of-statement t]
  411.        "---"
  412.        ["Macro Expand Region"    c-macro-expand (mark)]
  413.        ["Backslashify"           c-backslash-region (mark)]
  414.        )))
  415.     (cons modestr m)))
  416.  
  417.  
  418.  
  419. ;; Support for C
  420.  
  421. (defvar c-mode-abbrev-table nil
  422.   "Abbreviation table used in c-mode buffers.")
  423. (define-abbrev-table 'c-mode-abbrev-table ())
  424.  
  425. (defvar c-mode-map ()
  426.   "Keymap used in c-mode buffers.")
  427. (if c-mode-map
  428.     nil
  429.   (setq c-mode-map (c-make-inherited-keymap))
  430.   ;; add bindings which are only useful for C
  431.   (define-key c-mode-map "\C-c\C-e"  'c-macro-expand)
  432.   )
  433.  
  434. ;;;###autoload
  435. (defvar c-mode-syntax-table nil
  436.   "Syntax table used in c-mode buffers.")
  437. (if c-mode-syntax-table
  438.     ()
  439.   (setq c-mode-syntax-table (make-syntax-table))
  440.   (c-populate-syntax-table c-mode-syntax-table))
  441.  
  442. (easy-menu-define c-c-menu c-mode-map "C Mode Commands"
  443.           (c-mode-menu "C"))
  444.  
  445.  
  446. ;; Support for C++
  447.  
  448. (defvar c++-mode-abbrev-table nil
  449.   "Abbreviation table used in c++-mode buffers.")
  450. (define-abbrev-table 'c++-mode-abbrev-table ())
  451.  
  452. (defvar c++-mode-map ()
  453.   "Keymap used in c++-mode buffers.")
  454. (if c++-mode-map
  455.     nil
  456.   (setq c++-mode-map (c-make-inherited-keymap))
  457.   ;; add bindings which are only useful for C++
  458.   (define-key c++-mode-map "\C-c\C-e" 'c-macro-expand)
  459.   (define-key c++-mode-map "\C-c:"    'c-scope-operator)
  460.   (define-key c++-mode-map "<"        'c-electric-lt-gt)
  461.   (define-key c++-mode-map ">"        'c-electric-lt-gt))
  462.  
  463. ;;;###autoload
  464. (defvar c++-mode-syntax-table nil
  465.   "Syntax table used in c++-mode buffers.")
  466. (if c++-mode-syntax-table
  467.     ()
  468.   (setq c++-mode-syntax-table (make-syntax-table))
  469.   (c-populate-syntax-table c++-mode-syntax-table)
  470.   ;; TBD: does it make sense for colon to be symbol class in C++?
  471.   ;; I'm not so sure, since c-label-key is busted on lines like:
  472.   ;; Foo::bar( i );
  473.   ;; maybe c-label-key should be fixed instead of commenting this out,
  474.   ;; but it also bothers me that this only seems appropriate for C++
  475.   ;; and not C.
  476.   ;;(modify-syntax-entry ?: "_" c++-mode-syntax-table)
  477.   )
  478.  
  479. (easy-menu-define c-c++-menu c++-mode-map "C++ Mode Commands"
  480.           (c-mode-menu "C++"))
  481.  
  482.  
  483. ;; Support for Objective-C
  484.  
  485. (defvar objc-mode-abbrev-table nil
  486.   "Abbreviation table used in objc-mode buffers.")
  487. (define-abbrev-table 'objc-mode-abbrev-table ())
  488.  
  489. (defvar objc-mode-map ()
  490.   "Keymap used in objc-mode buffers.")
  491. (if objc-mode-map
  492.     nil
  493.   (setq objc-mode-map (c-make-inherited-keymap))
  494.   ;; add bindings which are only useful for Objective-C
  495.   (define-key objc-mode-map "\C-c\C-e" 'c-macro-expand))
  496.  
  497. ;;;###autoload
  498. (defvar objc-mode-syntax-table nil
  499.   "Syntax table used in objc-mode buffers.")
  500. (if objc-mode-syntax-table
  501.     ()
  502.   (setq objc-mode-syntax-table (make-syntax-table))
  503.   (c-populate-syntax-table objc-mode-syntax-table)
  504.   ;; add extra Objective-C only syntax
  505.   (modify-syntax-entry ?@ "_" objc-mode-syntax-table))
  506.  
  507. (easy-menu-define c-objc-menu objc-mode-map "ObjC Mode Commands"
  508.           (c-mode-menu "ObjC"))
  509.  
  510.  
  511. ;; Support for Java
  512.  
  513. (defvar java-mode-abbrev-table nil
  514.   "Abbreviation table used in java-mode buffers.")
  515. (define-abbrev-table 'java-mode-abbrev-table ())
  516.  
  517. (defvar java-mode-map ()
  518.   "Keymap used in java-mode buffers.")
  519. (if java-mode-map
  520.     nil
  521.   (setq java-mode-map (c-make-inherited-keymap))
  522.   ;; add bindings which are only useful for Java
  523.   )
  524.  
  525. ;;;###autoload
  526. (defvar java-mode-syntax-table nil
  527.   "Syntax table used in java-mode buffers.")
  528. (if java-mode-syntax-table
  529.     ()
  530.   (setq java-mode-syntax-table (make-syntax-table))
  531.   (c-populate-syntax-table java-mode-syntax-table))
  532.  
  533. (easy-menu-define c-java-menu java-mode-map "Java Mode Commands"
  534.           (c-mode-menu "Java"))
  535.  
  536.  
  537. ;; Support for CORBA's IDL language
  538.  
  539. (defvar idl-mode-abbrev-table nil
  540.   "Abbreviation table used in idl-mode buffers.")
  541. (define-abbrev-table 'idl-mode-abbrev-table ())
  542.  
  543. (defvar idl-mode-map ()
  544.   "Keymap used in idl-mode buffers.")
  545. (if idl-mode-map
  546.     nil
  547.   (setq idl-mode-map (c-make-inherited-keymap))
  548.   ;; add bindings which are only useful for IDL
  549.   )
  550.  
  551. ;;;###autoload
  552. (defvar idl-mode-syntax-table nil
  553.   "Syntax table used in idl-mode buffers.")
  554. (if idl-mode-syntax-table
  555.     nil
  556.   (setq idl-mode-syntax-table (make-syntax-table))
  557.   (c-populate-syntax-table idl-mode-syntax-table))
  558.  
  559. (easy-menu-define c-idl-menu idl-mode-map "IDL Mode Commands"
  560.           (c-mode-menu "IDL"))
  561.  
  562.  
  563.  
  564. (provide 'cc-langs)
  565. ;;; cc-langs.el ends here
  566.